package com.xinya.wanandroidclient.ui.articleList

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.xinya.wanandroidclient.base.BaseViewModel
import com.xinya.wanandroidclient.bean.ArticleBean

/**
 *
 * @ClassName:      ArticleViewModel$
 * @Description:    java类作用描述
 * @Author:         xinya
 * @CreateDate:     2021/3/2$ 18:43$
 * @UpdateRemark:   更新内容
 * @Version:        1.0
 */
class ArticleViewModel : BaseViewModel() {
    private var currentPage = 1

    private val repo by lazy {
        ArticleRepo(viewModelScope)
    }

    val articleLiveData by lazy {
        MutableLiveData<ArticleBean>()
    }

    fun getProject(type: Int, tabId: Int, refresh: Boolean) {
        if (refresh) {
            currentPage = 1
        }
        repo.getProjectArticle(type, tabId, currentPage++, articleLiveData,refreshStateLiveData)
    }


}